<template>
  <div id="app" class="a111">
    <!--<van-nav-bar title="" left-text="返回" left-arrow>-->
    <!--  <template #right>-->
    <!--    <van-icon name="search" size="18" />-->
    <!--  </template>-->
    <!--</van-nav-bar>-->

    <router-view/> <!-- 这里会显示当前路由对应的组件 -->
    <!--    <van-tabbar v-model="active">-->
    <!--  <van-tabbar-item icon="home-o">标签</van-tabbar-item>-->
    <!--  <van-tabbar-item icon="search">标签</van-tabbar-item>-->
    <!--  <van-tabbar-item icon="friends-o">标签</van-tabbar-item>-->
    <!--  <van-tabbar-item icon="setting-o">标签</van-tabbar-item>-->
    <!--</van-tabbar>-->
  </div>
</template>

<script>
import {ref} from 'vue';
import router from "@/router";
import http from "./http";

export default {
  name: 'App',
  setup() {
    const active = ref(0);

    return {active};
  },

}

// 定时器引用
const intervalRef = ref(null);

// 发送请求的函数
const sendRequest = async () => {
   http.post('user/refreshtoken/',{"retoken":localStorage.getItem("retoken")}).then(res=>{
     if (res.data.code==200) {
        localStorage.setItem('userid',res.data.userid)
        localStorage.setItem('token',res.data.token)
        localStorage.setItem('retoken',res.data.retoken)
     }else {
       router.push('/login')
     }
   })

};


// 每30分钟（1800000毫秒）发送一次请求
intervalRef.value = setInterval(sendRequest, 1800000);

</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}



</style>
